﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;

namespace FrameworkWPFdemo
{
    public   class DemoViewModel :ObservableObject
    {


        private ObservableCollection<Infomation> _Infos = new ObservableCollection<Infomation>();
        public ObservableCollection<Infomation> Infos
        {
            get => _Infos  ;
            set => SetProperty(ref _Infos  , value);
        }


        public ICommand ShowCmd { get; set; }

        public DemoViewModel()
        {

            PreProccess();

            this.ShowCmd = new RelayCommand<object>(ShowExe);
        }

        private void PreProccess()
        {
            ObservableCollection<Infomation> infomations = new ObservableCollection<Infomation>();
            infomations.Add(new Infomation() ); ;
            infomations.Add(new Infomation() ); ;
            infomations.Add(new Infomation() ); ;
            infomations.Add(new Infomation() ); ;

            Infos = infomations;

        }

        private void ShowExe(object infomations)
        {

            List<Infomation> infomations1= new List<Infomation>();
           
            foreach (var infomation in (IList)infomations)
            { 
             var inf   =infomation as Infomation;
                infomations1.Add(inf);
            }


        }
    }
}
